#ifndef __SIM900_H
#define __SIM900_H

#ifdef __cplusplus
 extern "C" {
#endif
	 /*----------------------------------------------------------------------------------------------*/
#include <stdint.h>
	
#include "misc.h"

   #define MAX_RX_BUF 500
   #define MAX_CALL_BUF 50

   extern char sim_callBuf[MAX_RX_BUF];   //nen de 3 buffer cung kich thuoc ->khong phai kiem tra kich thuoc khi copy tu rxBuf sang
   extern unsigned char sim_smsArrived;
   extern unsigned char sim_smsArriveFlag;
   extern unsigned char sim_callDoneFlag;
   //define Cmd type
   #define SendCmd                0
   #define ConnectToServer        1
   #define WriteDataNoResp        2
   #define SendSMS                3
   #define ReadSMS                4
   #define Call                   5
   //define Status of Command
   #define CMD_OK     0
   #define CMD_ERR    1
   
   typedef struct
   {
     char sim_rxBuf[MAX_RX_BUF];
     //uint16_t sim_rxBufLen;
     uint16_t sim_rxBufPointer;
   }RxBuffer;
   extern RxBuffer rxBuf;
   typedef struct
   {
     uint8_t status;
     char *sender;
     char *content;     
   }SMS;
   typedef struct
   {
     char cmd[50];
     uint8_t status;
     uint16_t timeOut;
     uint8_t retry;
     uint8_t cmdType;
   }SimCmd;
   extern SimCmd sim_cmd;
    uint8_t GSM_AddTask(SimCmd *sim_cmd,char *cmd, uint8_t type, uint32_t timeOut, uint8_t retry);
   void vGSMTask(void *arg);
   void vProcessNewSMS(void *arg);
   void vProcessIncommingCall(void *arg);
	 /*-----------------------------------------------------------------------------------------------*/

	 
#ifdef __cplusplus
}
#endif

#endif /* __MISC_H */


